package demo.day03

// 27 Kotlin语言的匿名函数与具名函数
fun main() {
    // 匿名函数
    showPersonInfo("Kiki", 18, 'm', "六年级一班") {
        println(it)
    }
    // 具名函数
    showPersonInfo("Qiqi", 8, 'm', "一年级一班", ::printResult)
}
// 具名函数要调用的函数
private fun printResult(result: String) {
    println(result)
}


inline fun showPersonInfo(name: String, age: Int, sex: Char, study: String, showResult: (String) -> Unit) {
    val str = "name:$name,age:$age,sex:$sex,study:$study"
    showResult(str)
}